The
Background
A need for a datasource that could handle ept documents arose when new sites was developed without Active Scripting components.
One commonly used solution was to read the data with code and expose it to a databound control. The
Configuration
There are two required settings;
The
Sorting
The
Creating and updating documents
The
Extended configuration
The
It's possible to apply a filter to the data selection process by setting the
List of configuration settings
Some of these settings can be specified as properties on the
A category id. This is only used when reading and creating documents. | |
ConnectionId | A connection id. This will be read from the current http request if possible. |
Specifies if drafts, approved content, or both, should be returned. Default is both approved content and drafts. Only used when reading documents. | |
DocumentTitleFieldName | The field that should be used as document title when creating new ept documents. Default is a guid value. Only used when creating documents. |
Determines if the document should be approved after it has been updated or created. Default is false. Only used when creating and updating documents. | |
A list of fields. | |
A filter that will be applied when reading documents. Default is an empty string. Only used when reading documents. | |
PageNumber | Current page number. Rarely used, most databound controls override this. Only used when reading documents. |
PageSize | Number of items per page. Rarely used, most databound controls override this. Only used when reading documents. |
Default sort order if none is provided by the databound control. Default is an empty string. Only used when reading documents. | |
UserSessionId | A session id. This will be read from the current http request if possible. |
Examples
The following code would work against the CS_CreatedDate, FirstName, LastName and Username fields in the Data/Members category. Data read will be sorted by the Username field ascending. Creating, updating and deleting documents will work.
HTML<csx:EptDataSource RunAt="Server" Id="dsMembers" CategoryId="Data/Members"
Fields="CS_CreatedDate,FirstName,LastName,Username" SortCommand="[Username] ASC" />
The following code has the same functionality, but has its configuration set as extended configuration with the different parameter collections.
HTML<csx:EptDataSource RunAt="Server" Id="dsMembers">
<SharedParameters>
<asp:Parameter Name="CategoryId" DefaultValue="Data/Members" />
<asp:Parameter Name="Fields" DefaultValue="CS_CreatedDate,FirstName,LastName,Username" />
<asp:Parameter Name="SortCommand" DefaultValue="[Username] ASC" />
</SharedParameters>
</csx:EptDataSource>
The
<csx:EptDataSource RunAt="Server" Id="dsMembers">
<SharedParameters>
<asp:Parameter Name="CategoryId" DefaultValue="Data/Members" />
<asp:Parameter Name="Fields" DefaultValue="CS_CreatedDate,FirstName,LastName,Username" />
<asp:Parameter Name="SortCommand" DefaultValue="[Username] ASC" />
<asp:Parameter Name="ContentToLoad" DefaultValue="Approved" />
</SharedParameters>
</csx:EptDataSource>
Another configuration scenario is when the business logic requires that new content needs to be approved by another process,
while updated content is approved automatically. We only need to change the settings for the
<csx:EptDataSource RunAt="Server" Id="dsMembers">
<SharedParameters>
<asp:Parameter Name="CategoryId" DefaultValue="Data/Members" />
<asp:Parameter Name="Fields" DefaultValue="CS_CreatedDate,FirstName,LastName,Username" />
<asp:Parameter Name="SortCommand" DefaultValue="[Username] ASC" />
<asp:Parameter Name="ContentToLoad" DefaultValue="Approved" />
</SharedParameters>
<UpdateParameters>
<asp:Parameter Name="EnableApprove" DefaultValue="true" />
</UpdateParameters>
</csx:EptDataSource>